<MonitorWindow:TeamMemberBadgeBase x:Class="ScrumSprintMonitor.UI.Wpf.Views.MonitorWindow.UnassignedTeamMemberBadge"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ScrumSprintMonitor.UI.Wpf" 
    xmlns:converters="clr-namespace:ScrumSprintMonitor.UI.Wpf.Converters" 
    xmlns:MonitorWindow="clr-namespace:ScrumSprintMonitor.UI.Wpf.Views.MonitorWindow"
    mc:Ignorable="d">

    <MonitorWindow:TeamMemberBadgeBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\..\Styles\TeamMemberBaseStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <converters:WorkTimeRatioBrushValueConverter x:Key="WorkTimeRatioBrushValueConverter" />

            <!--<local:XamlServiceLocator x:Key="serviceLocator" />-->
        </ResourceDictionary>
    </MonitorWindow:TeamMemberBadgeBase.Resources>

    <!--<MonitorWindow:TeamMemberBadgeBase.DataContext>
        <Binding Path="TeamMembersListViewModel.UnassignedTeamMembers[0]" Source="{StaticResource serviceLocator}"/>
    </MonitorWindow:TeamMemberBadgeBase.DataContext>-->

    <Grid>
        <!-- Glow-on-update element -->
        <Border Style="{StaticResource GlowOnUpdateStyle}" BorderThickness="0" Background="Black" CornerRadius="2,32,2,32" />

        <Border Background="Black" CornerRadius="2,32,2,32">
            <Border.Effect>
                <!-- Create a drop shadow. This is a very expensive effect, very noticeable in the animations. -->
                <DropShadowEffect BlurRadius="5" Color="Black" ShadowDepth="10" Opacity="0.3" />
            </Border.Effect>
        </Border>

        <Border x:Name="border" Loaded="OnGlassPanelLoaded" BorderBrush="#7F000000" BorderThickness="1,1,1,1" CornerRadius="2,32,2,32">
            <Border.Background>
                <MultiBinding Converter="{StaticResource WorkTimeRatioBrushValueConverter}" ConverterParameter="Background">
                    <Binding Path="RemainingSprintWorkWithUnassigned" />
                    <Binding Path="RemainingSprintHours" />
                    <Binding Path="NotAllWorkItemsEstimated"/>
                </MultiBinding>
            </Border.Background>

            <Grid>
                <Grid Margin="32">
                    <Grid.Style>
                        <Style TargetType="{x:Type Grid}">
                            <Setter Property="TextBlock.Foreground">
                                <Setter.Value>
                                    <MultiBinding Converter="{StaticResource WorkTimeRatioBrushValueConverter}" ConverterParameter="Foreground">
                                        <Binding Path="RemainingSprintWorkWithUnassigned"/>
                                        <Binding Path="RemainingSprintHours"/>
                                        <Binding Path="NotAllWorkItemsEstimated"/>
                                    </MultiBinding>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Grid.Style>

                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Grid Grid.ColumnSpan="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource AvatarDataTemplate}"/>

                        <StackPanel Orientation="Horizontal" Grid.Column="1">
                            <TextBlock Style="{StaticResource TeamMemberNameLabel}" Text="{Binding Path=DisplayName}" />
                            <TextBlock Text="{Binding Path=Team, StringFormat='{} ({0})'}">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock" BasedOn="{StaticResource TeamMemberNameLabel}">
                                    <Setter Property="Visibility" Value="Visible"/>
                                    
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Team}" Value="">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding Team}" Value="{x:Null}">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                            </TextBlock>
                        </StackPanel>
                    </Grid>

                    <TextBlock Grid.Row="1" Style="{StaticResource InfoLabel}">Open Backlog Items:</TextBlock>
                    <TextBlock Grid.Row="1" Grid.Column="1" Style="{StaticResource NumericValueLabel}" Text="{Binding Path=RemainingWorkItemCount}" />

                    <TextBlock Grid.Row="2" Style="{StaticResource InfoLabel}">Estimated Workload:</TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="1">
                        <TextBlock.Style>
                            <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource NumericValueLabel}">
                                <Setter Property="Text" Value="{Binding Path=RemainingSprintWork, StringFormat='{}{0:N0}h'}" />

                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding NotAllWorkItemsEstimated}" Value="True">
                                        <Setter Property="Text" Value="{Binding Path=RemainingSprintWork, StringFormat='{}{0:N0}h+'}" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBlock.Style>
                    </TextBlock>
                </Grid>

                <ContentPresenter ContentTemplate="{StaticResource GlassPanel}"/>
            </Grid>
        </Border>
    </Grid>
</MonitorWindow:TeamMemberBadgeBase>
